/*
 * Copyright 2010 Pieter De Rycke
 *
 * This file is part of Frozen Bubble XNA.
 *
 * Frozen Bubble XNA is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2, as published by the Free Software Foundation.
 *
 * Frozen Bubble XNA is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with Frozen Bubble XNA. If not, see 
 * <http://www.gnu.org/licenses/>.
 *
 * Artwork:
 *    Alexis Younes <73lab at free.fr>
 *      (everything but the bubbles)
 *    Amaury Amblard-Ladurantie <amaury at linuxfr.org>
 *      (the bubbles)
 *
 * Soundtrack:
 *    Matthias Le Bidan <matthias.le_bidan at caramail.com>
 *      (the three musics and all the sound effects)
 *
 * Design & Programming:
 *    Guillaume Cottenceau <guillaume.cottenceau at free.fr>
 *      (design and manage the project, whole Perl sourcecode)
 *
 * XNA and Windows Phone 7 port:
 *    Pieter De Rycke
 *
 * Websites:
 *    http://www.frozen-bubble.org/
 *    http://pieterderycke.wordpress.com/
 */

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace FrozenBubble
{
    public enum InputAction { Right, Left, Fire, Center, Pause, Any, End }

    public interface IInputController
    {
        InputState State { get; }
    }

    public struct InputState
    {
        private bool _left;
        private bool _right;
        private bool _fire;
        private bool _center;
        private bool _pause;
        private bool _any;
        private bool _end;

        public InputState(bool left, bool right, bool fire, bool center, bool pause, bool any, bool end)
        {
            _left = left;
            _right = right;
            _fire = fire;
            _center = center;
            _pause = pause;
            _any = any;
            _end = end;
        }

        public bool IsActionActive(InputAction action)
        {
            switch (action)
            {
                case InputAction.Left:
                    return _left;
                case InputAction.Right:
                    return _right;
                case InputAction.Fire:
                    return _fire;
                case InputAction.Center:
                    return _center;
                case InputAction.Pause:
                    return _pause;
                case InputAction.Any:
                    return _any;
                case InputAction.End:
                    return _end;
                default:
                    return false;
            }
        }
    }
}
